# -*- coding: utf-8 -*-
# @Time    : 2022/7/18 0:39
# @Author  : haichuan
# @Email   : 2263126410@163.com
# @File    : xtbs_zzxg_schupage.py
# @Software: PyCharm
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import  sleep
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
from pages.denglu_page import Deng_BasePage

                        # 删除部门

class DeleteBum(Deng_BasePage):
    url=("http://localhost/crm/")
    # 定位器
    '''进入组织架构'''
    user_Heads=(By.CSS_SELECTOR,'li.dropdown:nth-child(6) > a:nth-child(1)')
    zzjg_xlk=(By.CSS_SELECTOR,'li.dropdown:nth-child(6) > ul:nth-child(2) > li:nth-child(4) > a:nth-child(1)')
    zzjg__jgzz=(By.CSS_SELECTOR,'.page-header > h4:nth-child(1) > small:nth-child(1) > a:nth-child(1)')
    '''组织架构-测试01部门鼠标悬浮'''
    bumen_delete=(By.XPATH,'/html/body/div[5]/div[2]/form/div[2]/ul/li/ul/li[7]/span')
    bumen_delete_tne=(By.XPATH,'/html/body/div[5]/div[2]/form/div[2]/ul/li/ul/li[7]/span/span/a[2]')

    def jr_zzjg(self):
        '''点击头像-选择组织架构-进入组织架构页面'''
        self.driver.find_element(*self.user_Heads).click()
        self.driver.find_element(*self.zzjg_xlk).click()
        self.driver.find_element(*self.zzjg__jgzz).click()

    def xuanfu_bum(self):
        "删除部门的鼠标悬浮操作"
        action=ActionChains(self.driver)
        action_delete=self.driver.find_element(*self.bumen_delete)
        action.move_to_element(action_delete).perform()

    def xuanze_dele(self):
        '''在删除的对象上点击删除'''
        sleep(0.5)
        self.driver.find_element(*self.bumen_delete_tne ).click()

    def tsk(self):
        '''提示框'''
        self.driver.switch_to.alert.accept()
